home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 May / MacHome CD (May 2001).iso / mac / Stuff / Software / Tools / The Fragmalyzer 1.5.1 / Extras / Headers & Libraries / Plug-ins / HexBrowserAPI.h next >
Encoding:
C/C++ Source or Header  |  2000-11-08  |  3.3 KB  |  88 lines  |  [TEXT/CWIE]

  1. /*    
  2.     File:        HexBrowserAPI.h
  3.     
  4.     Hex Section Browser Plug-in Interface
  5.     
  6.     Version:    1.0
  7.     Date:    October 2000
  8.     
  9.     Copyright © 1998-2000 Dan Wright, All rights reserved.
  10.  
  11.     Bugs?:     Please include the name of this file, the version, and the date (above). 
  12.             Send bug reports to danwr@kagi.com. 
  13.     
  14.     Updates:     http://www.halcyon.com/danwr/smoothie.html
  15. */
  16.  
  17. #ifndef __HEXBROWSERAPI__
  18. #define __HEXBROWSERAPI__
  19.  
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. enum    {
  26.     kSigPluginHexBrowser    = FOUR_CHAR_CODE('Hex$'),
  27.     
  28.     kCmdNothing            = 0,
  29.     kCmdBrowseData        = 1,
  30.     kCmdBrowseCode        = 2,
  31.     kCmdBrowseLoader        = 3
  32.     
  33.     };
  34.  
  35.  
  36. enum    {
  37.     kNoReloc = 0,    // data is data is data
  38.     kSect1Reloc,    // relative to address of specified section
  39.     kSect2Reloc,
  40.     kSect3Reloc,
  41.     kSect4Reloc,
  42.     kSect5Reloc,
  43.     kSect6Reloc,
  44.     kImportReloc,    // data is to be replaced by the address of an imported symbol (prgb gets index of symbol)
  45.     
  46.     kFirstByteMask = 8    // data is the first (high byte) of value
  47.     };
  48.  
  49.  
  50. #define sectReloc(isect) (kSect1Reloc + (isect))
  51. #define sectReloc32(isect) (((kSect1Reloc + isect) * 0x01010101) | (kFirstByteMask << 24))
  52. #define import32 ((kImportReloc * 0x01010101) | (kFirstByteMask << 24))
  53. #define isectFromReloc(relocB) (((relocB) & 7) - 1)
  54.  
  55.  
  56.  
  57. typedef pascal WindowPtr    (*HexFindFragmentBrowserProcPtr)(FragmentRef, SInt8);
  58. typedef pascal WindowPtr    (*HexFindLocatorBrowserProcPtr)(ConstFrazLocatorPtr, SInt8);
  59. typedef pascal Boolean     (*HexGotoFragmentOffsetProcPtr)(FragmentRef, UInt8, UInt32);
  60. typedef pascal Boolean     (*HexGotoLocatorOffsetProcPtr)(ConstFrazLocatorPtr, UInt8, UInt32);
  61. typedef pascal SInt32     (*HexGetOffsetInfoProcPtr)(ConstFrazLocatorPtr, UInt8, UInt32, Size, Ptr, Ptr);
  62. typedef pascal Boolean     (*HexFindReferencesProcPtr)(ConstFrazLocatorPtr, SInt8, UInt8, UInt32, UInt32, UInt32 *, UInt32 *);
  63. typedef pascal SInt32     (*HexFindTextProcPtr)(ConstFrazLocatorPtr, SInt8, SInt32, char *, UInt32);
  64. typedef pascal SInt32     (*HexFindHexProcPtr)(ConstFrazLocatorPtr, SInt8, SInt32, char *, UInt32);
  65.  
  66.  
  67. /* note on section parameter:
  68.     If section >= 0, it represents the sectionKind (see PEFBinaryFormat.h);
  69.     if section < 0, it is a negative, one-based index [that is, -(isect + 1) ] */
  70. pascal WindowPtr HexFindLocatorBrowser(ConstFrazLocatorPtr plocator, SInt8 section);
  71. pascal WindowPtr HexFindBrowser(FragmentRef fragment, SInt8 section);
  72. pascal WindowPtr HexOpenSectionBrowser(ConstFrazLocatorPtr plocator, ConstStringPtr stFragmentName, SInt8 section);
  73. pascal Boolean HexGotoLocatorOffset(ConstFrazLocatorPtr plocator, SInt8 section, UInt32 offset);
  74. pascal Boolean HexGotoOffset(FragmentRef fragment, SInt8 section, UInt32 offset);
  75. pascal SInt32 HexGetOffsetInfo(ConstFrazLocatorPtr plocator, SInt8 section, UInt32 offset, Size cbMax, Ptr prgb, Ptr prgreloc);
  76.  
  77. pascal Boolean HexGetImportName(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 isym, StringPtr pstSymbol);
  78.  
  79. pascal SInt32 HexFindText(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 startingOffset, char *text, UInt32 cch);
  80. pascal SInt32 HexFindHex(ConstFrazLocatorPtr plocator, SInt8 section, SInt32 startingOffset, char *text, UInt32 cch);
  81.  
  82. pascal Boolean HexFindReferences(ConstFrazLocatorPtr plocator, SInt8 section,
  83.                         UInt8 sectionTarget, UInt32 offsetTarget,
  84.                         UInt32 crefMax,
  85.                         UInt32 *prgRefOffsets,
  86.                         UInt32 *pcRefs);
  87.  
  88. #endif /* __HEXBROWSERAPI__ */